-- UserDefaultM
-- Create by zouyb
-- 封装cc.UserDefault

module("UserDefaultM", package.seeall);

-- 键值对
local keyValues = {};

-- 根据键值获取字符串
function getStringForKey(key)
    if keyValues[key] ~= nil then
        return keyValues[key];
    end

    local value = nil;
    if not isVerifyClient() then
        value = cc.UserDefault:getInstance():getStringForKey(key);
    end
        
    keyValues[key] = value;
    return value;
end

-- 根据键值设置字符串
function setStringForKey(key, value)
    if not isVerifyClient() then
        cc.UserDefault:getInstance():setStringForKey(key, value);
    end    
    keyValues[key] = value;
end
